// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  devtools: { enabled: true },
  css: ["~/assets/style/common.css", "element-plus/dist/index.css"], //引入全局样式
  routeRules: {},
  components: [
    { path: '~/pages/user/Share/components' },
    { path: '~/pages/business/components' },
    { path: '~/pages/user/message/components' },
    { path: '~/components' },
  ],
  router: {},
  app: {
    baseURL: "/",
    pageTransition: { name: "slide-right", mode: "out-in" },
    head: {
      viewport: 'width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
      title: 'tigerSlot',
      meta: [
          { name: 'keywords', content: '淳渔影视,最新电影，最新电视剧' },
          { name: 'description', content: '淳渔影视更新最快的影视网站之一，收集了全网最新高分电影,电视剧,综艺,动漫等热播剧目免费在线观看！' }
      ],
      link: [
          // { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
      ]
  }
  },
  experimental: {
    // inlineSSRStyles: false,
  },
  modules: [
    "@element-plus/nuxt",
    "@pinia/nuxt",
    "@pinia-plugin-persistedstate/nuxt",
    "@nuxt/image",
  ], //引入elementPlus

  alias: {}, //配置路径别名
  build: {
    analyze: true,
    
  },
  // buildDir:"uu",
  // generate: {
  //   routes: [
  //     "/user/wallet",
  //     "/user/wallet",
  //     "/user/bonus",
  //     "/user/betting",
  //     "/user/wallet",
  //     "/user/bonus",
  //     "/user/wallet",
  //     "/user/wallet",
  //     "/user/bonus",
  //   ],
  // },

  ssr: true,
  spaLoadingTemplate: "spa-loading-template.html",
  vite: {
    css: {
      preprocessorOptions: {
        scss: {
          additionalData: '@use "~/assets/style/common.scss" as *;', //引入全局sass
        },
      },
    },
    build: {
      rollupOptions: {
        output: {
          manualChunks: (id) => {
            if (id.includes("element-plugin")) {
              return "componentUi";
            } else if (id.includes("axios")) {
              return "axios";
            } else if (id.includes("lodash")) {
              return "lodash";
            }
          },
        },
      },
    },
    server: {
      proxy: {
        "/api": {
          target: "https://jsgame.live",
          changeOrigin: true,
          // 可选的路由重写规则
          rewrite: (path) => path.replace(/^\/api/, ""),
        },
        "/API": {
          target: "https://c.u7games.com/",
          changeOrigin: true,
          // 可选的路由重写规则
          rewrite: (path) => path.replace(/^\/API/, ""),
        },
      },
    },
  },
  nitro: {
    // IIS options default
    devProxy: {
      "/api": {
        target: "https://jsgame.live",
        changeOrigin: true,
        // 可选的路由重写规则
      },
      "/API": {
        target: "https://c.u7games.com/",
        changeOrigin: true,
        // 可选的路由重写规则
      },
    },
    compressPublicAssets: true, // 启动压缩
    iis: {
      // merges in a pre-existing web.config file to the nitro default file
      mergeConfig: true,
      // overrides the default nitro web.config file all together
      overrideConfig: false,
    },
    prerender: {
      //预渲染路由
      routes: ["/"],
    },
  },
  devServer: {
    host: "192.168.12.106", //配置ip
    port: 9999, //配置端口号
    //   loadingTemplate: () => `
    //   <div style="font-size: 20px;">
    //     <p>yuutiewrutyiuretywuretiwertyuui</p>
    //     <p>uytoierutwoireutopreiutwoiertuorietuoweriuteorituoietuwoiuowiewoeitoeguoifdgkjsfdhgsghjjgshgsjfhgjgh</p>
    //   </div>
    // `,
  },
});
